import 'dart:ffi';

class HRV {
  late double hF;
  late double hFNorm;
  late double lF;
  late double lFDivideHF;
  late double lFNorm;
  late double pNN50;
  late double rMSSD;
  late double sD1;
  late double sD2;
  late double sDNN;
  late double sDSD;
  late double tP;
  late double vAI;
  late double vLF;
  late double vLI;
  late double heartRate;
  late int heartRateCycle;
  late double heartRateCycleAvg;
  late int heartRateCycleOriginal;
  late double heartRateMax;
  late double heartRateMin;
  late double heartRateMinAll;
  late double heartRateOriginal;
  late double heartRateTenAvg;
  late List<List<Double>> his;
  late double meanRate;
  late List<List<Double>> power;
  late List<List<Double>> scatterChartPoint;
  late List<double> sequence;

  HRV.fromJson(Map<String, dynamic> json) {
    hF = json['HF'];
    hFNorm = json['HFNorm'];
    lF = json['LF'];
    lFDivideHF = json['LFDivideHF'];
    lFNorm = json['LFNorm'];
    pNN50 = json['PNN50'];
    rMSSD = json['RMSSD'];
    sD1 = json['SD1'];
    sD2 = json['SD2'];
    sDNN = json['SDNN'];
    sDSD = json['SDSD'];
    tP = json['TP'];
    vAI = json['VAI'];
    vLF = json['VLF'];
    vLI = json['VLI'];
    heartRate = json['heartRate'];
    heartRateCycle = json['heartRateCycle'];
    heartRateCycleAvg = json['heartRateCycleAvg'];
    heartRateCycleOriginal = json['heartRateCycleOriginal'];
    heartRateMax = json['heartRateMax'];
    heartRateMin = json['heartRateMin'];
    heartRateMinAll = json['heartRateMinAll'];
    heartRateOriginal = json['heartRateOriginal'];
    heartRateTenAvg = json['heartRateTenAvg'];
    if (json['his'] != null) {
      his = [];
      json['his'].forEach((v) {
        his.add(List.from(v));
      });
    }
    meanRate = json['meanRate'];
    if (json['power'] != null) {
      power = [];
      json['power'].forEach((v) {
        power.add(List.from(v));
      });
    }
    if (json['scatterChartPoint'] != null) {
      scatterChartPoint = [];
      json['scatterChartPoint'].forEach((v) {
        scatterChartPoint.add(List.from(v));
      });
    }
    sequence = json['sequence'].cast<double>();
  }
}
